package work.work_02.oop;

/**
 * @author: lys
 * @类名: HourlyEmployee
 * @Title:
 * @date: 2020/7/15
 **/
public class HourlyEmployee extends ColEmployee {
    //定义属性
    private double hourMoney;
    private double workTime;

    //构造方法
    public HourlyEmployee(){}
    public HourlyEmployee(String empName,int empMonth,double hourMoney,double workTime){
        super(empName,empMonth);
        this.hourMoney = hourMoney;
        this.workTime = workTime;
    }

    //getSalary方法,获取按小时拿工资的员工的工资
    public double getSalary(int month){
        //本月过生日
        if(month == super.getEmpMonth()){
            //工作超过160小时
            if(workTime>160){
                return hourMoney*160+(hourMoney-160)*1.5+100;
            }else{
                //工作未超过160小时
                return hourMoney*workTime+100;
            }
        }else{
            //本月不过生日
            //工作超过160小时
            if(workTime>160){
                return hourMoney*160+(hourMoney-160)*1.5;
            }else{
                //工作未超过160小时
                return hourMoney*workTime;
            }
        }
    }

    //getter和setter方法
    public double getHourMoney() {
        return hourMoney;
    }

    public void setHourMoney(double hourMoney) {
        this.hourMoney = hourMoney;
    }

    public double getWorkTime() {
        return workTime;
    }

    public void setWorkTime(double workTime) {
        this.workTime = workTime;
    }
}
